package com.spring.demo.publicutil.util;

import java.security.SecureRandom;
import java.util.Base64;

public class A {
    public static void main(String[] args) {
        // 生成 32 字节 (256 位) 的随机密钥
        SecureRandom random = new SecureRandom();
        byte[] bytes = new byte[32];
        random.nextBytes(bytes);

        // 转换为 Base64 字符串
        String secretKey = Base64.getEncoder().encodeToString(bytes);

        System.out.println("Generated Nacos Secret Key: " + secretKey);
        

    }
}
